#include <OSA.h>
#include <string.h>
#include "uart.h"
#include "binsem.h"

extern OST_PMSG    pmsg;
extern OST_PMSG    p_tmsg;
extern OST_QMSG   RS_qmsg_tx;



void ftoa(float Value, char* Buffer);

void task_uart (void)
{
	OST_MSG msg;
	

	void *ptemperature;
	float *ff;
	//char BUF[10];               // Buffer for received data from UART
    char Message[20];    // Message body
    //char *str;
    for (;;)
    {
	    
		OS_WaitMsg(pmsg, msg);
//		OS_Delay(10);
		memcpy(Message, msg,10);
//		uart1_tx_str(msg);		
		
		OS_SetBSem(RS_NEW_MSG);
		OS_SendQMsg (RS_qmsg_tx, (OST_MSG*)msg);	

		OS_WaitMsg(p_tmsg, ptemperature);
		ff = (float*)ptemperature;
		//str = Message;
		
	    ftoa(*ff,Message); 
	    //memcpy(Message, msg,10);
		//ftoa(*ff,str,'2','F');
		uart1_tx_str(Message);		
		uart1_tx_byte('\r');	
        OS_Yield();
    }
}
